package cn.wolfcode.trip.base.domain;

import cn.wolfcode.trip.base.util.JSONUtil;
import lombok.Getter;
import lombok.Setter;

import java.util.HashMap;
import java.util.Map;

@Setter
@Getter
public class User extends BaseDomain{
    public static final Integer gender_DEFAULT = -1;//保密
    public static final Integer gender_MAN = 1;//男
    public static final Integer gender_WOMEN = 0;//女
    private String email;//邮箱

    private String nickName;//昵称

    private String password;//密码

    private String place;//地区

    private String headImgUrl;//头像

    private Integer gender;//性别

    private String coverImgUrl;//背景

    private String sign;//备注
    //获取性别名称
    public String getGenderName(){
        String msg = "保密";
        if (gender == gender_MAN){
            msg = "男";
        }else if (gender == gender_WOMEN){
            msg = "女";
        }
        return msg;
    }
    //获取json属性
    public String getJson(){
        Map<String, Object> map = new HashMap<>();
        map.put("id",id);
        map.put("nickName",nickName);
        map.put("gender",gender);
        map.put("place",place);
        map.put("sign",sign);
        map.put("headImgUrl",headImgUrl);
        map.put("coverImgUrl",coverImgUrl);
        return JSONUtil.toJSONString(map);
    }
}